<!DOCTYPE HTML>
<html th:with="title='新增分类',module='/js/app/common/uploadapk.js'">
<head th:include="fragments/header :: header">
</head>
<body>
	<div class="page-container">
		<form action="/manager/classify/save" method="post" class="form form-horizontal" id="classify-form">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">版本编号：</label>
				<div class="formControls col-xs-2 col-sm-2">
					<input type="text" class="input-text size-L" id="vcode" name="vcode">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>
					版本名称：
				</label>
				<div class="formControls col-xs-2 col-sm-2">
					<input type="text" class="input-text size-L" id="vname" name="vname">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>
					上传文件：
				</label>
				<input type="hidden" id="classifyImg" name="classifyImg">
				<div class="col-xs-8 col-sm-8 col-xs-offset-4 col-sm-offset-4" style="margin: 0;">
					<div id="uploader-demo">
						<!--用来存放item-->
						<div id="apkfileList" class="uploader-list"></div>
						<div id="apkfilePicker" class="btn btn-primary radius">浏览文件</div>
					</div>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>
					下载地址：
				</label>
				<div class="formControls col-xs-4 col-sm-4">
					<input type='text' class='input-text size-L' id='downUrl' name='downUrl' disabled>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>
					文件大小：
				</label>
				<div class="formControls col-xs-2 col-sm-2">
					<input type='text' class='input-text size-L' id='size' name='size' disabled>

				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>
					app类型：
				</label>
				<div class="formControls col-xs-2 col-sm-2">
					<span class="select-box">
						<select class="select size-L" id="appType" name="appType">
							<option value="1" selected="selected">ios</option>
							<option value="2">android</option>
						</select>
					</span>

				</div>

			</div>

			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>
					是否强制更新：
				</label>
				<div class="formControls col-xs-2 col-sm-2">
					<span class="select-box">
						<select class="select size-L" id="isForced" name="isForced">
							<option value="0" selected="selected">否</option>
							<option value="1">是</option>
						</select>
					</span>
				</div>

			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">更新详情：</label>
				<div class="formControls col-xs-4 col-sm-4">
					<textarea class="textarea" placeholder="请输入本次主要更新内容..." rows="" cols="" name="updateDoc" id="updateDoc"></textarea>
				</div>
			</div>

			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary size-S radius" type="submit" value="提交">
					<input class="btn btn-primary size-S radius" type="button" onclick="closeWin()" value="关闭">
				</div>
			</div>
		</form>
	</div>

	<script type="text/javascript">
		function closeWin() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}

		$(function() {

			$("#classify-form").validate({
				rules : {
					classifyName : {
						required : true,
						maxlength : 200
					}
				},
				onkeyup : false,
				focusCleanup : true,
				success : "valid",
				submitHandler : function(form) {
					var data = $('#classify-form').serialize();
					$.ajax({
						type : "POST",
						url : '/manager/appversion/save',
						data : data,
						beforeSend : function() {

						},
						complete : function() {

						},
						error : function(request) {
							layer.alert("系统出错");
						},
						success : function(data) {
							if (data.status == 0) {
								refreshUParentList();
								layer.alert(data.message, function() {
									var index = parent.layer.getFrameIndex(window.name);
									parent.layer.close(index);
								});
							} else {
								layer.alert(data.message);
							}
						}
					});
				}
			});
		});
	</script>
</body>
</html>